package com.sangmo.fts.training.service;

import com.sangmo.boot.framework.plugin.dataview.crud.service.BaseViewService;
import com.sangmo.boot.framework.plugin.dataview.data.IDataViewRepo;
import com.sangmo.fts.training.model.Teammate;
import com.sangmo.fts.training.repo.TeammateRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class TeammateEntityService extends BaseViewService<Teammate> {

    @Autowired
    private TeammateRepo teammateRepo;

    @Override
    protected IDataViewRepo<Teammate> getRepo() {
        return teammateRepo;
    }

    protected List<Teammate> findByTeamId(Long teamId) {
        return teammateRepo.findByTeamId(teamId);
    }

    protected  Teammate findByTeamIdAndUserId(Long teamId, Long userId) {
        return teammateRepo.findByTeamIdAndUserId(teamId, userId);
    }

}
